use std::convert::Infallible;

use apikit::rpc::{ParamAppender, RequestParamSign};
use reqwest::RequestBuilder;
use serde::Serialize;

use crate::param::{__TypeMapper, Query};

impl<T: Serialize> RequestParamSign<Query<T>> for __TypeMapper {
    type Input = Query<T>;
}

impl<T: Serialize> ParamAppender<RequestBuilder> for Query<T> {
    type Error = Infallible;

    fn append_param(self, builder: RequestBuilder) -> Result<RequestBuilder, Self::Error> {
        let builder = builder.query(&self.0);
        Ok(builder)
    }
}
